#pragma once
#include "PreInclude.h"

template<typename T>
void PrintData(T* data, int size)
{
	std::string splitter = "";
	for (int i = 0; i < size; ++i)
	{
		std::cout << splitter << data[i];
		splitter = ",";
	}
	std::cout << std::endl;
}

template<typename T>
void PrintData(T* data, int left, int right)
{
	std::string splitter = "";
	for (int i = left; i <= right; ++i)
	{
		std::cout << splitter << data[i];
		splitter = ",";
	}
	std::cout << std::endl;
}

template<typename T>
void Swap(T& left, T& right)
{
	T temp = left;
	left = right;
	right = temp;
}

template<typename T>
int Compare(const T* left, const T* right)
{
	if (*left < *right) return -1;
	if (*left > * right) return 1;
	return 0;
}

template<typename T>
int Compare(T* left, T* right)
{
	if (*left < *right) return -1;
	if (*left > * right) return 1;
	return 0;
}

template<typename T>
int Compare(const T& left, const T& right)
{
	if (left < right) return -1;
	if (left > right) return 1;
	return 0;
}

template<typename T>
int Compare(T& left, T& right)
{
	if (left < right) return -1;
	if (left > right) return 1;
	return 0;
}

template<typename T>
void CheckInOrder(T* data, int size)
{
	for (int i = 0; i < size - 1; ++i)
	{
		if (Compare(data[i], data[i + 1]) > 0)
		{
			std::cout << "sort failed..." << std::endl;
			return;
		}
	}
}

